package com.peas.platform.common.core.configuration;

/*
@Component
public class Swagger2WebMvcSwaggerTransformationFilter implements WebMvcSwaggerTransformationFilter {

    @SuppressWarnings("NullableProblems")
    @Override
    public boolean supports(DocumentationType delimiter) {
        return DocumentationType.SWAGGER_2.equals(delimiter);
    }

    @Override
    public Swagger transform(SwaggerTransformationContext<HttpServletRequest> context) {
        if (context == null)
            return null;
        Swagger swagger = context.getSpecification();
        Map<String, Model> definitions = swagger.getDefinitions();
        if (CollUtil.isNotEmpty(definitions)) {
            for (String key : definitions.keySet()) {
                Model model = definitions.get(key);
                Map<String, Property> properties = model.getProperties();
                if (CollUtil.isEmpty(properties))
                    continue;
                Map<String, Property> sortedProperties = new LinkedHashMap<>(properties.size());
                List<String> fieldNameList = properties.entrySet().stream()
                        .sorted(Map.Entry.comparingByValue(
                                Comparator.comparing(Property::getPosition)
                                        .thenComparing(Property::getName)))
                        .map(Map.Entry::getKey)
                        .collect(Collectors.toList());
                if (CollUtil.isNotEmpty(fieldNameList)) {
                    for (String fieldName : fieldNameList) {
                        sortedProperties.put(fieldName, properties.get(fieldName));
                    }
                }
                model.getProperties().clear();
                model.setProperties(sortedProperties);
            }
        }
        return swagger;
    }
}
*/

public class Swagger2WebMvcSwaggerTransformationFilter {

}
